/*
 * Copyright (c) 2006-2020, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author                 Notes
 * 2021-03-12     JiangYangJie       the first version
 */
#include "key.h"
#include "rtthread.h"

struct Key_s Key;

void Key_Init(void){
    Key.S2 = rt_pin_get("PF.1");
    Key.S3= rt_pin_get("PF.0");
    Key.S4 = rt_pin_get("PA.2");
    // 上拉输入
    rt_pin_mode(Key.S2, PIN_MODE_INPUT_PULLUP );
    rt_pin_mode(Key.S3, PIN_MODE_INPUT_PULLUP );
    rt_pin_mode(Key.S4, PIN_MODE_INPUT_PULLUP );
}

int Read_S2(void)
{
    return rt_pin_read(Key.S2);
}

int Read_S3(void)
{
    return rt_pin_read(Key.S3);
}

int Read_S4(void)
{
    return rt_pin_read(Key.S4);
}